<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" layout:decorate="body/main">
<head>
    <meta charset="UTF-8">
    <title>添加</title>
</head>
<body>
<div class="right_col" role="main" layout:fragment="content">
    <div class="">
        <div class="clearfix"></div>
        <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_panel">
                    <div class="x_title">
                        <h2>新增角色信息 <i class="fa fa-user"></i><small></small></h2>
                        <div class="clearfix"></div>
                    </div>
                    <div class=""><!--x_content-->
                        <div class="clearfix"></div>
                        <form class="form-horizontal form-label-left" action="/user/save" th:action="@{/role/save(roleId=${role.roleId})}" method="post" enctype="multipart/form-data">
                            <div class="item form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="roleName">角色名称 <span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input id="roleName" class="form-control col-md-7 col-xs-12"
                                           data-validate-length-range="20" data-validate-words="1" name="roleName"  required="required"
                                           placeholder="请输入用角色名称" type="text" th:value="${role.roleName}">
                                </div>
                            </div>
                            <div class="item form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="roleDesc">角色描述 <span class="required"> </span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <!--<input id="roleDesc" class="form-control col-md-7 col-xs-12"
                                           data-validate-length-range="20" data-validate-words="1" name="roleDesc"   required="required"
                                           placeholder="请输入角色描述" type="text">-->
                                    <textarea id="roleDesc" class="form-control col-md-7 col-xs-12" data-validate-length-range="20" data-validate-words="1" name="roleDesc"   required="required">[[${role.roleDesc}]]</textarea><!--[[${role.roleDesc}]]-->
                                </div>
                            </div>

                            <div class="item form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="roleFlag">角色状态 <span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="checkbox" value="1" id="roleFlag" name="roleFlag" style="margin: 10px 2px" th:checked="${role.roleFlag eq 1}">(是否启用)
                                </div>
                            </div>
                            <div class="item form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12">指派权限 <span class="required">*</span>
                                </label>
                                <div class="col-md-6 col-sm-6 col-xs-12" style="padding-top: 7px;">
                                    <ul style="list-style: none;padding-left: 0px">
                                        <li th:if="${right1.rightType == 'Folder'}" th:each="right1:${rights}">
                                            <input type="checkbox" name="rightCodes" th:value="${right1.rightCode}"
                                            th:checked="${roleRights.contains(right1)}"/>
                                            <span th:text="${right1.rightText}">一级权限</span>
                                            <ul style="list-style: none">
                                                <li th:if="${right2.rightType == 'Document' && right2.rightParentCode == right1.rightCode}"
                                                    th:each="right2:${rights}">
                                                    <input type="checkbox" name="rightCodes" th:value="${right2.rightCode}"
                                                    th:checked="${roleRights.contains(right2)}">
                                                    <span th:text="${right2.rightText}">二级权限</span>
                                                </li>
                                            </ul>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div class="ln_solid"></div>
                            <div class="form-group">
                                <div class="col-md-6 col-md-offset-3">
                                    <button id="send" type="submit" class="btn btn-success">保存</button>
                                    <button type="button" class="btn btn-primary" id="back" onclick="history.back()">返回</button>
                                    <br/><br/>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>